<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:replace="top::html" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

<body class="fixed hold-transition skin-blue">
    <div class="wrapper">
        <div th:replace="tophtml::html"></div>
        <div th:replace="left::html"></div>
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    <span>需求管理</span> 
                    <small></small>
                </h1>
                <ol class="breadcrumb">
                    <li><a th:href="@{/index}"><i class="fa fa-dashboard"></i>用户中心</a></li>
                    <li><a th:href="@{/demand/showQuery}">需求管理</a></li>
                </ol>
            </section>

            <section class="content container-fluid">
                <p style="color: red;" th:text="${searchEmpty}"></p>
                <form  id="from1" class="form-inline" th:action="@{/demand/showConditionQuery}" method="get">
                    <input type="hidden" name="pageNo" id="pageNo" />
                    <input type="hidden" th:if="${demand}" name="collectPersonId" th:value="${demand.collectPersonId}" />
                    <div class="form-group">
                        <input style="width: 500px; display: inline" type="text" class="form-control" placeholder="id或名称或联系人或单位" name="searchKeyword" th:value="${searchKeyword}">
                        <label><input type="radio" name="tag" value="1" th:checked="${demand} ? ${demand.tag} == 1">联系人</label>
                        <label><input type="radio" name="tag" value="2" th:checked="${demand} ? ${demand.tag} == 2">单位</label>
	                    <button type="submit" class="btn btn-primary" style="margin-left: 40px;">搜索</button>
	                    <button type="reset" class="btn btn-primary" style="margin-left: 40px;">重置</button>
	                    <button type="button" class="btn btn-primary" onclick="javascript:window.location.href='/demand/showAdd'" style="margin-left: 40px;">添加</button>
                    </div><br>
                    <div class="form-group">
                        <label>需求类型</label>
                        <span th:each="dtd : ${demandTypeDictiontryList}">
                            <label style="font-weight: lighter;">
                                <input type="checkbox" name="demandType" th:value="${dtd.names}" th:text="${dtd.worth}" th:checked="${demandTypedArr != null ? #arrays.contains(demandTypedArr, dtd.names) : false}">
                            </label>
                        </span>
                    </div><br>
                    <div class="form-group">
                        <label>所属领域</label>
                        <span th:each="rfd : ${researchFieldDictiontryList}">
                            <label style="font-weight: lighter;">
                                <input type="checkbox" name="researchField" th:value="${rfd.names}" th:text="${rfd.worth}" th:checked="${researchFieldArr != null ? #arrays.contains(researchFieldArr, rfd.names) : false}">
                            </label>
                        </span>
                    </div><br>
                    <div class="form-group">
                        <label>需求状态</label>
                        <select name="demandStatus">
                        	<option value="">-请选择-</option>
                            <option th:each="psd : ${demandStatusDictiontryList}" th:value="${psd.pid}" th:text="${psd.worth}" th:selected="${demand} ? ${demand.demandStatus == psd.pid}">状态</option>
                        </select>
                    </div>
                    <div>
                        <span class="from-group">
	                        <label>国内国外</label>
                            <label style="font-weight: lighter;">
		                        <input type="radio" name="domesticOrForeign" id="optionsRadios1" value="0" th:checked="${demand != null ? demand.domesticOrForeign == 0 : false}"> 国内
                            </label>
                            <label style="font-weight: lighter;">
		                        <input type="radio" name="domesticOrForeign" id="optionsRadios2" value="1" th:checked="${demand != null ? demand.domesticOrForeign == 1 : false}"> 国外
                            </label>
                        </span>
                        <span class="form-group form-country">
                            <select class="form-area">
                                <option value="-1">--选择国家--</option>
                                <option th:each="list:${countryDictiontryList}" th:value="${list.pid}" th:text="${list.worth}" th:selected="${list.pid eq country}"></option>
                            </select>
                        </span>
                        <span class="form-group form-area">
	                        <select class="form-area" id="provinceId">
	                            <option value="-1">--选择省--</option>
	                            <option th:each="list:${provinceDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq province}"></option>
	                        </select>
                        </span>
                        <span class="form-group form-area">
	                        <select class="form-area" id="cityId">
	                            <option value="-1">--选择市--</option>
	                            <option th:each="list:${cityDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq city}"></option>
	                        </select>
                        </span>
                        <span class="form-group form-area">
	                        <select class="form-area" id="areaId">
	                            <option value="-1">--选择区--</option>
	                            <option th:each="list:${areaDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq district}"></option>
	                        </select>
                        </span>
                    </div>
                   
                </form>
                <!-- <form th:action="@{/demand/importDemand}" method="post"  enctype="multipart/form-data">
                    <table>
                        <tr>
                            <td>
                                <input type="file" name="file">
                            </td>
                            <td>
                                <button type="submit" class="btn btn-primary">导入</button>
                            </td>
                        </tr>
                    </table>
                </form> -->
                
                <div class="box">
                    <div class="box-body">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <th>需求id</th>
                                    <th>需求名称</th>
                                    <th>录入人</th>
                                    <th>录入时间</th>
                                    <th>需求单位</th>
                                    <th>需求状态</th>
                                    <th>需求联系人</th>
                                    <th>操作</th>
                                </tr>
                                <tr th:each="demand : ${pageInfo.list}">
                                    <td title="查看需求详情">
                                        <a th:href="@{'/demand/showDetail?demandId='+${demand.pid}}" th:text="'D' + ${demand.demandNumber}">详情</a>
                                    </td>
                                    <td th:title="${demand.demandName}" th:text="${#strings.length(demand.demandName)} > 20 ? ${#strings.substring(demand.demandName, 0, 20)}+'...' : ${demand.demandName}">
                                    </td>
                                    <td th:text="${demand.collectPersonId}">录入人</td>
                                    <td th:text="${demand.entryTime}">时间</td>
                                    <td th:text="${demand.demandUnit}">单位</td>
                                    <td th:text="${demand.demandStatusWorth}">状态</td>
                                    <td>
                                        <a th:if="${demand.per}" th:href="@{/demand/showUpdateContact(demandId=${demand.pid},demandContactId=${demand.per.pid})}" th:text="${demand.per.name}">联系人</a>
                                    </td>
                                    <td th:with="isSubed=${#lists.contains(subDemandIdList, demand.pid)}">
                                        <a th:href="@{'/project/showDemandMatchedProject?pid='+${demand.pid}}">匹配</a>|
                                        <a th:unless="${demand.per}" th:href="@{'/demand/showAddContact?demandId='+${demand.pid}}">添加联系人</a><span th:unless="${demand.per}">|</span>
                                        <a th:href="@{'/demand/showUpdate?demandId='+${demand.pid}}">修改</a>|
                                        <a th:if="${isSubed}" th:id="${demand.pid}" href="javascirpt:void(0)" th:onclick="'javascript:delSub(\''+${demand.pid}+'\',2)'">取消关注</a>
                                        <a th:unless="${isSubed}" th:id="${demand.pid}" href="javascirpt:void(0)" th:onclick="'javascript:subscribe(\''+${demand.pid}+'\',2)'">关注</a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div th:replace="page::html"></div>
                        <p style="color: red;" th:text="${demandContactIdExists}"></p>
                    </div>
                </div>
            </section>
        </div>
        <!-- Main Footer -->
        <div th:replace="footer::html"></div>
        <div class="control-sidebar-bg"></div>
    </div>
    <div th:replace="bottom::html"></div>
</body>

</html>